/*
 * 
 * LegendShop 多用户商城系统
 * 
 *  版权所有,并保留所有权利。
 * 
 */
package com.legendshop.oa.dao;
 
import com.legendshop.dao.Dao;
import com.legendshop.dao.support.CriteriaQuery;
import com.legendshop.dao.support.PageSupport;
import com.legendshop.oa.dto.AdminUserTaskEstimateDto;
import com.legendshop.oa.dto.Select2Dto;
import com.legendshop.oa.model.AdminUser;
import com.legendshop.oa.model.Role;

import java.util.Date;
import java.util.List;

/**
 * 用户Dao.
 */

public interface AdminUserDao extends Dao<AdminUser, Long> {
     
	AdminUser getAdminUser(Long id);
	
    int deleteAdminUser(AdminUser adminUser);
	
	Long saveAdminUser(AdminUser adminUser);
	
	int updateAdminUser(AdminUser adminUser);
	
	PageSupport<AdminUser> getAdminUser(CriteriaQuery cq);

	Boolean isAdminUserExist(String userName);

	int updateAdminUserPassword(Long id, String newPassword);

	List<Role> loadRole(String appNo);

	List<Role> loadRole(Long userId, String appNo);

	/**
	 * 给select2查询数据
	 * @param q
	 * @param pageSize
	 * @param currPage
	 * @return
	 */
	List<Select2Dto> userList(String q, Integer pageSize, Integer currPage);

	/**
	 * 给select2查询数据,查找我的团队
	 * @param q
	 * @param pageSize
	 * @param currPage
	 * @param leaderName
	 * @return
	 */
	List<Select2Dto> userListForMyColleague(boolean isAdmin, String q, Integer pageSize, Integer currPage, String leaderName);
	
	
	List<Select2Dto> userListForTeam(Long projectId, String q, Integer pageSize, Integer currPage);
	
	/**
	 * 给select2查询数据总数
	 * @param q
	 * @return
	 */
	int userCount(String q);

	/**
	 * 给select2查询数据总数,查找我的同事
	 * @param q
	 * @param leaderName
	 * @return
	 */
	int userCountForMyColleague(boolean isAdmin, String q, String leaderName);

	/**
	 * 在项目组下添加组员
	 * @param projectId
	 * @param q
	 * @return
	 */
	int userListForTeamCount(Long projectId, String q);

	List<Select2Dto> userListInTeam(Long projectId, String q, Integer pageSize, Integer currPage);

	int userListInTeamCount(Long projectId, String q);

	String getAdminUserByName(String userName);

	AdminUser getAdminUserByUserName(String userName);

	PageSupport<AdminUser> getAdminUserByDept(String curPageNO, AdminUser adminUser, Date startDate, Date endDate);

	PageSupport<AdminUser> getAdminUser(String curPageNO, AdminUser adminUser);

	List<AdminUserTaskEstimateDto> getAdminUserTaskEstimate(String userName, Date startDate, Date endDate);
}
